﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using update_server;
using update_client;
namespace update_start
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            string isServer = KG.IniOperation.ReadIniString("Run", "Auto");
            if (isServer != string.Empty)
            {
                if (isServer == "server")
                    Application.Run(new update_server.FrmServerMain());
                else
                    Application.Run(new update_client.FrmClientMain(args));
            }
            else
            {
                if (MessageBox.Show("是否永久激活服务端客户端？\n是:激活服务端\n否:激活客户端", "激活程序updateV1.2", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    KG.IniOperation.PutIniString("Run", "Auto", "server");
                    Application.Run(new update_server.FrmServerMain());
                    //Main(args);
                }
                else
                {
                    KG.IniOperation.PutIniString("Run", "Auto", "client");
                    Application.Run(new update_client.FrmClientMain(args));
                    //Main(args);
                }
            }

        }
    }
}
